<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:pr="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="WEB-INF/facelets/template.xhtml">

        <ui:param name="title" value="Register"/>

        <ui:define name="content">
            <h1>This is register.xhtml</h1>

            <h:form>
                <!--<h:inputHidden  name="action" value="register"/>-->
                <table>
                    <tr>
                        <td>Name:</td>
                        <td><h:inputText id="fname" styleClass="inputfield" value="#{registerBacking.user.name}" required="true"/><br/></td>
                    </tr>
                    <tr>
                        <td>Email:</td>
                        <td><h:inputText id="email" styleClass="inputfield" value="#{registerBacking.user.emailAddress}" required="true" validator="#{registerBacking.checkEmailInDatabase}"/><br/></td>
                    </tr>
                    <tr>
                        <td>Street:</td>
                        <td><h:inputText id="street" styleClass="inputfield" value="#{registerBacking.user.address.streetWithNumber}" required="true"/><br/></td>
                    </tr>

                    <tr>
                        <td>ZIP Code:</td>
                        <td><h:inputText id="zipcode" styleClass="inputfield" value="#{registerBacking.user.address.zipCode}" required="true"/><br/></td>
                        <td>City:</td>
                        <td><h:inputText id="city" styleClass="inputfield" value="#{registerBacking.user.address.area}" required="true"/><br/></td>
                    </tr>

                    <tr>
                        <td>Password:</td>
                        <td><h:inputSecret id="passwd" binding="#{password}" styleClass="inputfield" value="#{registerBacking.user.password}" required="true"/><br/>
                        </td>
                    </tr>
                    <tr>
                        <td>Repeat Password:</td>
                        <td>
                            <h:inputSecret id="passwdrepeat" styleClass="inputfield" validator="#{registerBacking.verifyPasswordValidator}">
                                <f:attribute name="password" value="#{password.value}" />
                            </h:inputSecret><br/>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><h:selectBooleanCheckbox value="#{registerBacking.user.newsLetter}"/> Newsletter <br/></td>
                    </tr>
                </table> 
                <h:commandButton value="Register" action="#{registerController.doRegister()}" />
                <pr:messages/>
            </h:form>
        </ui:define>
    </ui:composition>
</html>

